package library.admin.domain.request;

import library.admin.domain.po.BorrowRecord;
import library.admin.enums.BookStatus;
import io.swagger.annotations.ApiModelProperty;
import lombok.Data;

import java.time.LocalDateTime;

/**
 * 
 *
 */
@Data
public class BorrowBookRequest {
    @ApiModelProperty("用户编号")
    private Long userId;
    @ApiModelProperty("图书复本编号")
    private Long copyId;

    public BorrowRecord toBorrowRecord(){
        BorrowRecord borrowRecord = new BorrowRecord();
        borrowRecord.setUserId(this.userId);
        borrowRecord.setBookCopiesId(this.copyId);
        borrowRecord.setStatus(BookStatus.BORROWING.getValue());
        borrowRecord.setDueDate(LocalDateTime.now().plusDays(30));
        return borrowRecord;
    }
}
